package com.analyse.stock.model;

import com.analyse.stock.enums.StrategyEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_stock_analyse_focus")
public class StockAnalyseFocusModel extends BaseModel<StockAnalyseFocusModel> {

    private String stockCode;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date occTime;

    private BigDecimal price;

    /**
     * 所选策略
     */
    private String strategyCode;

    /**
     * 优先使用的策略参数
     */
    private String paramJson;

    //所选策略分析后的结果描述
    private String analyseResult;

    // 0-打榜买入，1-正常9.30后择时买入，9-其他方式
    private Integer buyType;

    //分析后的评分
    private BigDecimal score;

    public static StockAnalyseFocusModel me(Integer buyType,
                                            Date occTime, BigDecimal price, StrategyEnum strategy, BigDecimal score){
        StockAnalyseFocusModel model = new StockAnalyseFocusModel();
        model.setBuyType(buyType);
        model.setOccTime(occTime);
        model.setPrice(price);
        model.setScore(score);
        model.setStrategyCode(strategy.getCode());
        return model;
    }
}
